import pygame,sys,random,time
pygame.init()
screen=pygame.display.set_mode([300,150])#大小
screen.fill([255,255,255])

def shua():
    pygame.display.flip()
def a1():
    pygame.draw.rect(screen,[122,122,122],[30,75,75,40],0)
    shua()
def a2():
    pygame.draw.rect(screen,[122,122,122],[200,75,75,40],0)
    shua()

a1()
a2()
x=0
y=[200,115]
"""
for i in range(c5):
    x=random.randint(0,10)
    if x<4:
        
    if x>3 and x<7:
        pygame.draw.circle(screen,[random.randint(0,255),random.randint(0,255),random.randint(0,255)],[random.randint(0,c1-c1/5),random.randint(0,c2-c2/5)],random.randint(1,(c1+c2)/5),random.randint(c4,c3))
    if x>6:
        pygame.draw.ellipse(screen, [random.randint(0,255),random.randint(0,255),random.randint(0,255)], [random.randint(0,c1-c1/5),random.randint(0,c2-c2/5),random.randint(1,c1/2),random.randint(1,c2/2)],random.randint(c4,c3) )
pygame.display.flip()
"""
run=True
while run:
    for event in pygame.event.get():
        if  event.type == pygame.MOUSEBUTTONUP:
            if event.button==1:
                x1,y1=event.pos
                pygame.draw.rect(screen,[222,222,222],[30,75,75,40],0)
                if x1>30 and x1<105 and y1>75 and y1<115:
                    run=False
                if x1>y[x] and x1<y[x]+75 and y1>75 and y1<115:
                    x+=1
                    if x>1:
                        x-=2
                    pygame.draw.rect(screen,[255,255,255],[0,0,300,150],0) 
                    a1()
                    pygame.draw.rect(screen,[122,122,122],[y[x],75,75,40],0)
                    shua()
        if event.type==pygame.QUIT:
            run=False


pygame.quit()
#image.png